package io.eleKing.boot.weather.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import io.eleKing.boot.system.entity.BaseEntity;

import java.util.Date;

/**
 * 自动站
 *
 * @author eleKing
 * @since 2025-04-15
 */
@Data
@TableName("weather_station")
@EqualsAndHashCode(callSuper = true)
public class WeatherStation extends BaseEntity {

    /**
     * 行政区划
     */
    private String district;

    // 自定义setter方法，确保district只保存前6个字符
    public void setDistrict(String district) {
        if (district != null && district.length() > 6) {
            this.district = district.substring(0, 6);
        } else {
            this.district = district;
        }
    }

    public String getDistrict() {
        if (district != null && district.length() > 6) {
            return district.substring(0, 6);
        } else {
            return district;
        }
    }

    /**
     * 站号
     */
    private String stationId;

    /**
     * 站点名称
     */
    private String stationName;

    /**
     * 经度
     */
    private Double lng;

    /**
     * 纬度
     */
    private Double lat;

    /**
     * 省
     */
    private String province;

    /**
     * 市
     */
    private String city;

    /**
     * 县
     */
    private String area;

    /**
     * 镇
     */
    private String town;

    private Integer stationType;

    private Integer stationLevel;

    /**
     * 站点国家站的头号
     * @see isHead
     */
    private String isHead;

    /**
     * 1：陆地站点  2：海上站点
     * @see Judge
     */
    private Integer regionStation;


    @TableField(exist = false)
    private String stationLevelStr;
}